﻿using Dapper;
using System.Data.SqlClient;
using yunbo.Model.SM;

namespace yunbo.Repositorys.SMRepositorys
{
    public class WMS_RKXXRepository
    {
        public string data = "Data Source=121.37.93.71;Initial Catalog=FanXingMES;User ID=sa;Password=geili@2025;";
        public int PostWMS_RKXX(TJWMS_RKXX tJWMS_RKXX)
        {
            using (SqlConnection connection = new SqlConnection(data))
            {
                string sql = $"insert into wms_rkxx(rkxx_code,rk_code,wl_code,rkxx_wlmc,rkxx_wlfl,rkxx_ggxh,rkxx_rksl,kc_code)\r\n" +
                    $"values('{tJWMS_RKXX.rkxx_code}','{tJWMS_RKXX.rk_code}','{tJWMS_RKXX.wl_code}','{tJWMS_RKXX.rkxx_wlmc}','{tJWMS_RKXX.rkxx_wlfl}','{tJWMS_RKXX.rkxx_ggxh}',{tJWMS_RKXX.rkxx_rksl},'{tJWMS_RKXX.kc_code}')";
                int rs = connection.Execute(sql);
                return rs;
            }
        }
        public List<WMS_RKXX> GetWMS_RKXX(string code)
        {
            using (SqlConnection connection = new SqlConnection(data))
            {
                string sql = $"select * from wms_rkxx\r\nwhere rk_code='{code}'";
                List<WMS_RKXX> wMS_RKXXes = connection.Query<WMS_RKXX>(sql).ToList();
                return wMS_RKXXes;
            }
        }

    }
}
